package com.sky.wsp.sql.scanner.patterns.sql;

import com.sky.wsp.sql.scanner.patterns.BasePattern;
import com.sky.wsp.sql.scanner.vo.MatchResult;

import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;

public class MapperPattern extends BasePattern {
    public MapperPattern() {
        Map<String, Pattern> patterns = getPatterns();
        patterns.put("</select>", Pattern.compile("</select>"));
        patterns.put("</insert>", Pattern.compile("</insert>"));
        patterns.put("</delete>", Pattern.compile("</delete>"));
        patterns.put("</update>", Pattern.compile("</update>"));
    }

    @Override
    public List<MatchResult> match(String content) {
        // XML不区分大小写，所有要转小写进行匹配
        return super.match(content.toLowerCase());
    }
}
